package org.taobao.ibatiside.ui.wizard;

import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.modelbase.sql.query.QueryStatement;
import org.taobao.ibatiside.model.mapperv2.GeneralStatement;
import org.taobao.ibatiside.model.mapperv2.ParameterMap;
import org.taobao.ibatiside.model.mapperv2.ResultMap;
import org.taobao.ibatiside.model.mapperv2.SqlMap;
import org.taobao.ibatiside.ui.util.ClassField;
import org.taobao.ibatiside.ui.util.TypeWrapper;

public final class BatisSettingModelArgument {
	//All paths are full path
	String opSql;
	//Query statement
	QueryStatement dtpStmt;
	IConnectionProfile connectionProfile;
	IFile configurationFile;
	IFile sqlmapFile;
	//sqlmap object
	SqlMap sqlmap;
	GeneralStatement statement;
	
	//Data Object Bean
	boolean beanNeedCreate;
	List<DataObjectField> beanFields;
	IPath beanPath;
	URL beanTemplate;
	List<URL> beanTemplates;
	String beanDescription;
	//content
	boolean parameterRequired;
	boolean resultRequired;
	boolean parameterUseClass;
	TypeWrapper parameterClass;
	List<ClassField> activeClassFields;
	ParameterMap parameterMap;
	
	boolean resultUseClass;
	TypeWrapper resultClass;
	ResultMap resultMap;
	
	boolean daoPageRequired = true;
	boolean beautifierXml = true;
	//dao
	URL daoInterfaceTemplate;
	URL daoImplTemplate;
	URL springTemplate;
	boolean springIntegrate;
	
	List<URL> daoInterfaceTemplates;
	List<URL> daoImplTemplates;
	List<URL> springTemplates;
	IFile springConfiguration;
	String springBeanId;
	boolean daoNeedInterface;
	boolean daoCreateNewInterface;
	boolean daoCreateNewImplementation;
	IPath daoInterfacePath;
	IPath daoImplementationPath;
	static class _Field_Type{
		String name;
		String type;
		String slot1;
		String slot2;
		String slot3;
		int category; // 1 simple 2 list 3 map //4 eobject
	}
	static class BatisSettingModelArgumentResult {
		
		private Set<String> imports = new HashSet<String>();
		public boolean addImport(String e) {
			return imports.add(e);
		}
		private List<_Field_Type> fields = new ArrayList<_Field_Type>();
		public void addField(_Field_Type field){
			fields.add(field);
		}
		public List<_Field_Type> getFields() {
			return fields;
		}
		public Set<String> getImports() {
			return imports;
		}
	}
}
